//
//  SSSRecordOrderToEditingViewController.m
//  SSSMerchant
//
//  Created by 谢曦 on 2017/3/22.
//  Copyright © 2017年 xnxin. All rights reserved.
//

#import "SSSRecordOrderToEditingViewController.h"
#import "SSSRecordOrderDetailViewController.h"
#import "SSSRecordOrderToEditingCell.h"
@interface SSSRecordOrderToEditingViewController ()
{
    UILabel *_ratioLable;
}

@end

@implementation SSSRecordOrderToEditingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.tableView ..height-=61;
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
//    [self bottomBar];
    self.isShowBottomBar=YES;
     self.bottomBarTitle=@"设置默认上传比例";
    self.title=@"待编辑";
    [self configData];
}
-(void)configData{
    NSMutableArray *arr=@[].mutableCopy;
    for (int i=0; i<10; i++) {
        SSSRecordOrderModel *model=[SSSRecordOrderModel new];
        model.money=[NSString stringWithFormat:@"1000%d",arc4random()%20];
        model.date=@"2017-3-20";
        model.time=@"13:20:09";
        model.phone=@"13320990999";
        model.type=1;
        model.customerNumber=@"e7qwtye7ywqewqey";
        model.uploadMoney=@"1700888";
        model.name=@"小明的店";
        model.customerNickname=@"小明没看那个命名";
         model.orderNumber=@"126537621536213567125763";
         model.personName=@"小明";
        [arr addObject:model];
    }
    self.dataArr=arr.copy;
    [self.tableView reloadData];

    
}
    

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    SSSRecordOrderToEditingCell *cell=[SSSRecordOrderToEditingCell cellForTableView:tableView withIdentifier:@"SSSRecordOrderToEditingCell"];
    cell.model=self.dataArr[indexPath.row];
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 90;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    SSSRecordOrderDetailViewController *detailVC=[[SSSRecordOrderDetailViewController alloc] init];
    detailVC.model=self.dataArr[indexPath.row];
    [self.navigationController pushViewController:detailVC animated:YES];
}
//-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
//    return 0;
//}
-(void)bottomBarTap{
    XXSheetView *sheet=[XXSheetView sheetViewWithTitle:@"选择上传比例" redButtonTitle:nil otherbuttonTitle:@[@"5%",@"10%",@"15%"]];
    sheet.defaultTextCancel=@"暂不设置";
    sheet.sheetViewRedButtonClickBlock=^{
       
    };
    sheet.sheetViewOtherButtonClickBlock=^(NSUInteger index,NSString *title){
        self.bottomBarTitle=[NSString stringWithFormat:@"默认上传比例（%@）",title];
        [self.dataArr enumerateObjectsUsingBlock:^(  SSSRecordOrderModel *model, NSUInteger idx, BOOL * _Nonnull stop) {
            model.ratio=title;
        }];
    };
    [sheet showSheetView];

    
    }
//-(UIView *)bottomBar{
//    UIView *bar=[[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 61)];
//    bar.backgroundColor=ThemeGreenColor;
//    [self.view addSubview:bar ];
//    UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(bottomBarTap)];
//    [bar addGestureRecognizer:tap];
//    
//    _ratioLable = [UILabel new] ;
//    _ratioLable.text=@"设置默认上传比例";
//    [_ratioLable sizeToFit];
//    [bar addSubview:_ratioLable];
//    _ratioLable.textColor=[UIColor whiteColor];
//    [bar mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.bottom.equalTo(self.view);
//        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, 61));
//    }];
//    
//    
//    [_ratioLable mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.center.equalTo(bar);
//        
//    }];
//    return bar;
//}

@end
